const Koa = require("koa");
const app = new Koa();
const bodyParser = require("koa-bodyparser");
const controller = require("../controller");

/**
 * 由于middleware的顺序很重要，这个koa-bodypareser 必须在router之前注册到app对象上
 */

// add  middleware
app
    .use(bodyParser())
    .use(controller())
    .on('error', console.error)
    .listen(3000);
console.log(`app started at 3000`)